
Page({

  data: {
   currentIndexNav:0,
   navList:[],
   swiperList:[],
   videosList:[]
  },

  activeNav(e){
    // console.log(e.target);
    this.setData({
      currentIndexNav:e.target.dataset.index
    })
  },

  getNavList(){
    let that = this;
    wx.request({
      url: 'https://www.fastmock.site/mock/be38daec3e9171cdb01c93689baff38b/bilibili/navList',
      success(res){
        // console.log(res);
        if(res.data.code === 0){
          that.setData({
            navList:res.data.data.navList
          })
        }
      }
    })
  },
  getSwiperList(){
    let that = this;
    wx.request({
      url: 'https://www.fastmock.site/mock/be38daec3e9171cdb01c93689baff38b/bilibili/swiperList',
      success(res){
        // console.log(res)
        if(res.data.code === 0){
            that.setData({
              swiperList:res.data.data.swiperList
            })
        }
      }
    })
  },
  getVideosList(){
    let that = this;
    wx.request({
      url: 'https://www.fastmock.site/mock/be38daec3e9171cdb01c93689baff38b/bilibili/videosList',
      success(res){
        // console.log(res);
        if(res.data.code === 0){
          that.setData({
            videosList:res.data.data.videosList
          })
        }
      }
    })
  },
  onLoad: function(options) {
    this.getNavList();
    this.getSwiperList();
    this.getVideosList();
  },
  onShow: function() {
    
  },
  onReady: function() {
  
  },
  onHide: function() {
    
  },
  onUnload: function() {

  },
  onPullDownRefresh: function() {
   
  },
  onReachBottom: function() {
    
  },
  onShareAppMessage: function () {
   
  },
  onPageScroll: function() {
   
  },
  onResize: function() {
   
  },
  onTabItemTap(item) {
   
    console.log(item.index)
    console.log(item.pagePath)
    console.log(item.text)
  },
  
  viewTap: function() {
    this.setData({
      text: 'Set some data for updating view.'
    }, function() {
      
    })
  },

  customData: {
    hi: 'MINA'
  }
})